// Copyright (c) 2020 Wang Zemin Personal. All Right Reserved

import {doGetRequest, doPostRequest, paginationToBackend} from "./BaseRequest";

/* Find all budget in server pageable */
export function fetchAllBudget(pagination,filters) {
    const data = {};
    Object.assign(data,paginationToBackend(pagination),filters);
    console.log("Begin to fetch key with filter:"+JSON.stringify(filters))
    return doPostRequest("/budget/manage/list", data)
}



/* Create a budget*/
export function createBudget(data) {
    return doPostRequest("/budget/manage/create", data)
}


/* update a budget */
export function updateBudget(data) {
    return doPostRequest("/budget/manage/update", data)
}

/* Find all budget auditing log server pageable */
export function fetchAllBudgetAuditingLog(pagination, filters) {
    const data = {};
    Object.assign(data, paginationToBackend(pagination), filters);
    console.log("Begin to fetch key with filter:" + JSON.stringify(filters))
    return doPostRequest("/budget/manage/list/auditing-log", data)
}


/* Find all budget auditing log server pageable */
export function getUserBudget() {
    const data = {};
    return doGetRequest("/budget/manage/user/budget", data)
}
